# 使用基础镜像
FROM alpine:latest

# 安装所需软件和依赖项
RUN apk add --no-cache bash wget gcc g++ make ffmpeg

# 下载SRS源码并构建
RUN wget https://image.yuelingnet.cn/SRS-CentOS7-x86_64-5.0-b6.zip && \
    unzip SRS-CentOS7-x86_64-5.0-b6.zip && \
    cd SRS-CentOS7-x86_64-5.0-b6 && \
    ./configure && \
    make

# 复制SRS可执行文件和配置文件到镜像中
RUN cp srs-5.2/objs/srs /usr/local/bin/srs
COPY srs.conf /usr/local/srs/conf/srs.conf

# 暴露RTMP和HTTP服务端口
EXPOSE 1935 8080

# 运行SRS服务器
CMD ["srs", "-c", "/usr/local/srs/conf/srs.conf"]